﻿@model MasResourceItem

@{
    int resSubGrpId = ViewBag.resSubGrpId;
    var resSubGrp = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().SelectResourceSubGroup(new MasResourceSubGroup{ResSubGrpId = resSubGrpId}, new []{"MasResourceGroup"}).FirstOrDefault();
    var resGrp = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().SelectResourceGroup(new MasResourceGroup{ResGrpId = resSubGrp.ResGrpId.Value},null).FirstOrDefault();
    var resType = new KPIS.GERP.WEB.GIMS.MasResourceService.MasResourceServiceClient().SelectResourceType(new MasResourceType{ResTypeId = resSubGrp.MasResourceGroup.ResTypeId.Value}, null).FirstOrDefault();
    ViewBag.CustomMenu = new Dictionary<string, string>
        {
            {
                "ประเภท " + resType.Code + " - " +  resType.Name, Url.Action("Index", "MasResourceType")
            }, 
            {
                "หมวด " + resGrp.Code + " - " + resGrp.Name, Url.Action("Index", "MasResourceGroup", new {resTypeId=resGrp.ResTypeId})
            }, 
            {
                "กลุ่ม " + resSubGrp.Code + " - " + resSubGrp.Name, Url.Action("Index", "MasResourceSubGroup", new {resGrpId = resSubGrp.ResGrpId})
            }, 
            {
                "รายการพัสดุต่างๆ", Url.Action("Index", "MasResourceItem", new {resSubGrpId = resSubGrp.ResSubGrpId})
            }
        };
	ViewBag.Title = "ข้อมูลรายการพัสดุ"; 
    ViewBag.Descr = "รายละเอิยดรายการพัสดุ" + (Model.Name ?? string.Empty);
}

<div class="block-button-menu-above">
    @Html.ButtonViewAll(new { ViewBag.resSubGrpId })
    @Html.ButtonEdit(new { id = Model.ResItemId, ViewBag.resSubGrpId})
    @Html.ButtonAdd(new { ViewBag.resSubGrpId })
    @Html.ButtonDelete(new { id = Model.ResItemId, ViewBag.resSubGrpId })
</div>
    
@Html.Partial("_DetailsForm")

@section scripts
{
    <script>
        
    </script>
}